package com.rtline.business.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import com.rtline.business.enums.LockType;

/**
 * <p>DistributedLock .分布式锁的实现注解
 *
 * <p>change history:
 *
 * <pre>
 * date         defect       person          comments
 * --------------------------------------------------------------------------------
 * 2025/6/1    ********     Tao Ren    create file.
 * </pre>
 *
 * @author Tao Ren
 * @date 2025/6/1 09:40
 */

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DistributedLock {
    String key(); // 锁的Key，支持SpEL表达式

    int waitTime() default 10; // 等待锁的最大时间（秒）

    int leaseTime() default 3; // 锁的持有时间（秒）

    LockType lockType() default LockType.TRY_LOCK; // 锁的类型，默认为TRY_LOCK
}
